{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set menu = 'admin_optimize_settings' %}

{% set script_controller = 'optimize/optimize' %}

{% block main %}

	{{ web_macro.flash_messages() }}




<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">{{'刷新缓存'|trans}}</h3>
  </div>
  <div class="panel-body">
  	<p>
      {{'刷新并重建缓存,让系统保持最优的状态。'|trans}} 
    </p>
    <p >
  		<button id="removecache" class="btn btn-primary fr " data-url="{{ url('admin_optimize_remove_cache') }}">{{'刷新缓存'|trans}}</button>
  	</p>
  </div>
</div>

	<div class="panel panel-default">
	  <div class="panel-heading">
	    <h3 class="panel-title">{{'优化磁盘空间'|trans}}</h3>
	  </div>
	  <div class="panel-body">
	   	<p>
	       {{'移除系统的临时数据，释放出更多磁盘空间。'|trans}}
	    </p>
	    <p >
	  		<button id="removeTmp" class="btn btn-primary fr" data-url="{{ url('admin_optimize_remove_tmp') }}">{{'优化磁盘空间'|trans}}</button>
	  	</p>
	  </div>
	</div>


<div class="panel panel-default" style="display: none">
  <div class="panel-heading">
    <h3 class="panel-title">{{'数据库备份和下载'|trans}}</h3>
  </div>
  <div class="panel-body">
   	<p>
       {{'备份数据库，并下载备份文件'|trans}}。 {{'下载完成后请'|trans}}<span class="text-info">{{'优化磁盘空间'|trans}}</span>。
    </p>
    <p>
  		<button id="backupDatabase" class="btn btn-primary fr" data-url="{{ url('admin_optimize_backupdb') }}">{{'数据库备份和下载'|trans}}</button>
  	</p>
  	<p>
  		<span id="dbbackup" class="glyphicon glyphicon-download-alt hide"><a id="dbdownload" href="#" target="_blank">{{'下载数据库备份'|trans}}</a></span>
  	</p>
  </div>
</div>

<hr/>
<h1><small>{{'谨慎操作区域'|trans}}</small></h1>
<hr/>

{% if 'upgrade' not in disabled_features %}
	<div class="panel panel-default">
	  <div class="panel-heading ">
	    <h3 class="panel-title text-warning">{{'清空系统备份数据'|trans}}</h3>
	  </div>
	  <div class="panel-body">
	   	<p class="text-warning">
	       {{'慎重：请确保当前系统已经升级成功。当系统升级过程中发生意外，备份的系统文件和数据库可用于恢复。'|trans}}
	    </p>   	
	    <p>
	       {{'清空系统升级过程中备份的系统文件和备数据库。通过清空系统备份数据，可以让系统释放出更多的磁盘空间'|trans}}
	    <p/>
	    <p >
	  		<button id="removeBackup" class="btn btn-warning fr" data-url="{{ url('admin_optimize_remove_backup') }}">{{ '清空系统备份数据'|trans }}</button>
	  	</p>
	  </div>
	</div>

{% endif %}

<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title text-warning">{{'优化课程视频和相关资料文件'|trans}}</h3>
  </div>
  <div class="panel-body">
   	<p class="text-warning">
       {{'注意：该功能慎用。请仔细阅读下列说明：'|trans}} 
    </p>
     <p>
       {{'优化课程文件，将已经不存在系统中的课程相关上传文件移除。假如您希望保留这些数据，
       请不要执行该功能。'|trans}}
    </p>
    <p>
  		<a id="optimizeFile" class="btn btn-danger fr" type="button" href="#modal" data-toggle="modal" data-url="{{ url('admin_optimize_remove_show_progressbar') }}">{{'优化课程文件'|trans}}</a>
  	</p>
  </div>
</div>

{% endblock %}